#include <bits/stdc++.h>
using namespace std;
#define int long long
bool cmp(pair<double, int>a,pair<double, int>b)
{
    if(a.first>b.first)return 1;
    else if(a.first==b.first)return a.second<b.second;
    else return 0;
}
// void test()
// {
//     double s=0.2*35/70+0.3*33/(50+33+25);
//     cout<<0.2*35/70/s<<" "<<0.3*33/(50+33+25)/s<<endl;
// }
void solve()
{
    int n,m,k,x;
    cin>>n>>m;
    vector<double>v(n+1),a(n+1);
    vector<pair<double, int>>s(n+1,{1,0});
    vector<vector<double>>w(n+1,vector<double>(m+1));
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        v[i]=(double)x/100;
        //cout<<v[i]<<endl;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>x;
            w[i][j]=(double)x/100;
            a[i]+=w[i][j];
        }
    }
    cin>>k;
    vector<int> z(k+1);
    for(int i=1;i<=k;i++)cin>>z[i];
    double y=0;
    for(int i=1;i<=n;i++)
    {
        s[i].first=v[i];
        for(int j=1;j<=k;j++)
        {
            s[i].first*=w[i][z[j]]/a[i];
            s[i].second=i;
        }
        s[i].first*=100;
        //cout<<s[i].first<<endl;
        y+=s[i].first;
    }
    //cout<<y<<endl;
    sort(s.begin()+1,s.end(),cmp);
    for(int i=1;i<=n;i++)
    {
        printf("%lld %0.2lf\n",s[i].second,s[i].first/y*100);
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
        //test();
       solve();
    }
    return 0;
}